/*
 * cryptomfs - a macfuse implementation of cryptofs.
 * Copyright (C) 2008  Greg J. Hedlund
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * Reads the .plist configuration for a .cryptomfs pacakge.
 */

#ifndef _HAS_CRYPTOMFSCONFIG_H_
#define _HAS_CRYPTOMFSCONFIG_H_

#define DEFAULT_MOUNTROOT "@CRYPT_PKG/mount"
#define DEFAULT_VOLNAME "Cryptomfs Volume"
#define DEFAULT_CIPHER "AES256"
#define DEFAULT_MD "MD5"
#define DEFAULT_BLOCKSIZE 2048
#define DEFAULT_SALTS 256

// path prefix denoting cyprotmfs package path
#define CRYPT_PKG "@CRYPT_PKG"

#define CRYPT_PKG_SUFFIX ".cryptofs"

#ifndef MAX_PATH
#define MAX_PATH 512
#endif

#define MAXVOLUMENAME 100
#define MAXCIPHERLENGTH 25
#define MAXMDLENGTH 25
#define MAXPASSLENGTH 128

typedef struct _CryptomfsConfig CryptomfsConfig;

// entries found in the .plist config file
struct _CryptomfsConfig {
	char packageroot[MAX_PATH];
	char volumeName[MAXVOLUMENAME];
	char volumeIcon[MAX_PATH];
	char mountPath[MAX_PATH];
	char passwordhash[MAXPASSLENGTH];
	char cipher[MAXCIPHERLENGTH];
	char md[MAXMDLENGTH];
	int blocksize;
	int salts;
};


int readConfig(const char* configFile, CryptomfsConfig* cfg);
int writeConfig(const char* configFile, CryptomfsConfig* cfg);

#endif


